/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

jQuery(document).ready(function(){
    winkStore();
})


function winkStore(){
    jQuery("#storeContainer").children(".store-element").each(function(){
        jQuery(this).children(".wink-store").click(function(){
            var url=Routing.generate('_winkstore',{
                alias : jQuery(this).parent(".store-element").attr("id")
            });
            var winkStoreElement=jQuery(this);
            jQuery.ajax({
                url: url,
                dataType: 'html',
                success: function(){
                    console.log(jQuery(this));
                    jQuery(winkStoreElement).html("winked");
                    jQuery(winkStoreElement).removeClass("wink-store").addClass("winked-store");
                }
            })
        }
        )
    })

}
